#include "mainwindow.h"
#include<QGraphicsScene>
#include<QGraphicsView>
#include<QDebug>
const int Window_Height=600;
const int Window_Width=950;
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
    qDebug()<<"scene构造函数";
    this->scene=new QGraphicsScene(150,0,Window_Width,Window_Height,this);
    qDebug()<<"scene构造函数";
    this->view=new QGraphicsView(scene,this);
    qDebug()<<"view构造函数";
    this->setFixedSize(Window_Width,Window_Height);


    //禁用索引，防止运行缓慢
    scene->setItemIndexMethod(QGraphicsScene::NoIndex);


    view->resize(Window_Width+2,Window_Height+2);
    view->setBackgroundBrush(QPixmap(":/resource/Background.jpg"));

    view->setRenderHint(QPainter::Antialiasing);
    view->setCacheMode(QGraphicsView::CacheBackground);
    view->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
    view->show();

}

MainWindow::~MainWindow()
{
    delete scene;
    delete view;